<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin:0;
            padding:0;
        }
        #box{
            height:100px;
            width:100px;
            padding:10px;
            border:10px solid red;
            background-color: red;
            overflow: scroll;
        }
    </style>
</head>
<body>
    <div id="box"></div>
    <script>
        //4
        //offsetWidth：content+左右padding+左右边框
        //offsetHeight：content+上下padding+上下边框
        console.log(box.offsetWidth);
        console.log(box.offsetHeight);

        //clientWidth：content+左右padding(-左右滚动条)
        //clientHeight：content+上下padding(-上下滚动条)
        console.log(box.clientWidth);
        console.log(box.clientHeight);

    //    let html= document.documentElement||document.body;
    //    console.log(html.clientWidth);
    </script>
</body>
</html>